/**
 * RefreshDbConfigJob.java<br>
 *
 *
 * @version 下午11:44:02
 */
package com.iwechat.service.task;

import javax.annotation.Resource;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import com.iwechat.service.RefreshAble;

/**
 * 刷新数据库中配置信息的JOB
 */
@Service
public class RefreshDbConfigJob {
    private static final long   initialDelay = 1 * 1000;
    private static final long   fixedDelay   = 5 * 60 * 1000;

    @Resource(name = "clientfc")
    RefreshAble                 clientFactory;
    @Resource(name = "msgtmfc")
    RefreshAble                 msgTemplateFactory;

    /**
     * 5min调度一次
     */
    @Scheduled(initialDelay = initialDelay, fixedDelay = fixedDelay)
    public void Refresh() {
        clientFactory.refresh();
        msgTemplateFactory.refresh();
    }
}
